package com.sdjzu.wangfuying.hellospringboot.service;

import com.sdjzu.wangfuying.hellospringboot.bean.db.Student;
import com.sdjzu.wangfuying.hellospringboot.repository.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

@Service
public class StudentService {
    @Autowired
    private StudentRepository studentRepository;

    @Transactional
    public void save(Student student) {
        studentRepository.save(student);
    }

    @Transactional
    public Iterable<Student> findAll() {
        return studentRepository.findAll();
    }
}
